package com.cms.bs.app.controller;

import com.cms.bs.app.service.ILoginService;
import com.cms.bs.config.rs.RS;
import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by jiang on 2016-09-21.
 */
@Controller
public class LoginController {

    @Autowired
    private ILoginService loginService;

    @RequestMapping(value = "/login", method = RequestMethod.POST)
    @ResponseBody
//    public RS login(@RequestBody Map<String, Object> params){
//        return loginService.login(params);
//    }
    public RS login(String userName,String password){
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("name", userName);
        params.put("password", password);
        return loginService.login(params);
    }

}
